package com.sync.syncmasterdata.product.service.convert;

import com.sync.syncmasterdata.product.pojo.bip.ProductForBip;
import com.sync.syncmasterdata.product.pojo.bip.ProductStockForBip;
import com.sync.syncmasterdata.product.pojo.erp.InventoryForU8;
import com.sync.syncmasterdata.product.pojo.oa.InventoryForOA;
import com.sync.syncmasterdata.product.service.ConvertInterface;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * oa产品对象 转 BipMaterialStock对象
 */
@Service
public class ProductOAToBipStock implements ConvertInterface<InventoryForOA, ProductStockForBip> {

    public ProductStockForBip convertTo(InventoryForOA oa) {
        ProductStockForBip.StockBill.StockBillHead stockBillHead = new ProductStockForBip.StockBill.StockBillHead();
        stockBillHead.setPk_material(oa.getCunhuobm());
        /**
         * 是否分批次
         */
        stockBillHead.setWholemanaflag("N");
        //其他根据 需要再添加
        ProductStockForBip.StockBill stockBill = ProductStockForBip.StockBill.builder().billhead(stockBillHead).build();
        ProductStockForBip productStockForBip = ProductStockForBip.builder().bill(stockBill).build();
        return productStockForBip;
    }

}
